package thinkingJava.chapter14;

interface Interface {
	void doSomething();
	void somethingElse(String arg);
}
class RealObject implements Interface {
	public void doSomething() {
		System.out.println("do something");
	}
	public void somethingElse(String arg) {
		System.out.println("something else : " + arg);
	}
}
class SimpleProxy implements Interface {
	private Interface proxied;
	public SimpleProxy(Interface proxied) {
		this.proxied = proxied;
	}
	public void doSomething() {
		System.out.println("SimpleProxy something");
		proxied.doSomething();
	}
	public void somethingElse(String arg) {
		System.out.println("SimpleProxy somethingElse : " + arg);
		proxied.somethingElse(arg);
	}
}
public class SimpleProxyDemo {
	public static void consume(Interface face) {
		face.doSomething();
		face.somethingElse("bonodo");
	}
	public static void main(String[] args) {
		consume(new RealObject());
		consume(new SimpleProxy(new RealObject()));
	}
}
